import type { User } from "@/type";

/**
 * 获取粉丝列表
 * @param data
 */
export function getFansList(userId: string) {
    return useRequest<{
        list: Omit<User, 'password'>[],
    }>('/v1/user/getFansList', {
        method: 'get',
        params: {
            user_id: userId
        }
    })
}

/**
 * 判断是否是粉丝
 * @param userId 用户ID
 * @param goalUserId 需要判断的用户ID
 * @returns 
 */
export function getEstimateIsFans(userId: string, goalUserId: string) {
    return useRequest<{
        isFans: boolean
    }>('/v1/user/estimateIsFans', {
        method: 'get',
        params: {
            user_id: userId,
            goal_user_id: goalUserId
        }
    })
}

export type GetUserInfoResult = {
    nickname: User['nickname'],
    is_authentication: boolean,
    create_time: number,
    sex: User['sex'],
    sign: User['sign'],
}
/**
 * 获取用户信息
 */
export function getUserInfo(userId: string) {
    return useRequest<GetUserInfoResult>('/v1/user/getUserInfo', {
        method: 'get',
        query: {
            user_id: userId
        }
    })
}